package org.balabala.gateway.feign;

import org.balabala.gateway.entity.BrowseInfo;
import org.balabala.gateway.entity.Comment;
import org.balabala.gateway.entity.User;
import org.balabala.gateway.response.Resp;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;

@Component
@FeignClient(name = "user")
public interface UserFeign {

    /**
     * 用户登录
     * @param user
     * @return
     */
    @PostMapping("/balabala/user/login")
    Resp login(@RequestBody User user);

    /**
     * 用户注册
     * @param user
     * @return
     */
    @PostMapping("/balabala/user/register")
    Resp register(@RequestBody User user);

    /**
     * 根据uid查询用户信息
     * @param uid
     * @return
     */
    @GetMapping("/balabala/user/info/uid")
    Resp getUserInfo(@RequestBody Long uid);

    /**
     * 用户查询，支持模糊查询
     * @param page
     * @param limit
     * @param key
     * @return
     */
    @GetMapping("/balabala/user/list/keyword")
    Resp getUserList(@RequestParam Integer page, @RequestParam Integer limit, @RequestParam String key,@RequestParam Integer state);

    /**
     * 根据uid获取浏览记录
     * @param uid
     * @param page
     * @param limit
     * @return
     */
    @GetMapping("/balabala/browse/info")
    Resp getUserHistory(@RequestParam("uid") Long uid, @RequestParam("page") Integer page, @RequestParam("limit") Integer limit);

    /**
     * 添加喜欢的视频
     * @return
     */
    @PostMapping("/balabala/favorite/save")
    Resp setUserFavourite(@RequestParam Long uid,@RequestParam Long videoId);

    /**
     *获取用户喜欢的视频
     * @param uid
     * @param page
     * @param limit
     * @return
     */
    @GetMapping("/balabala/favorite/info")
    Resp getUserFavourite(@RequestParam Long uid, @RequestParam Integer page, @RequestParam Integer limit);

    /**
     * 更新用户信息
     * @param user
     * @return
     */
    @PostMapping("/balabala/user/update")
    Resp updateUserInfo(@RequestBody User user);

    /**
     * 添加评论
     * @param comment
     * @return
     */
    @PostMapping("/balabala/comment/save")
    Resp addComment(@RequestBody Comment comment);

    /**
     * 删除评论
     * @param commentId
     * @return
     */
    @PostMapping("/balabala/comment/delete")
    Resp delComment(@RequestBody Long commentId);

    /**
     * 获取用户发布的评论
     * @param uid
     * @param page
     * @param limit
     * @return
     */
    @PostMapping("/balabala/comment/info")
    Resp getUserComments(@RequestParam Long uid, @RequestParam Integer page, @RequestParam Integer limit);

    /**
     * 添加浏览记录
     * @param browseInfo
     * @return
     */
    @PostMapping("/balabala/browseinfo/save")
    Resp saveBrowseInfo(@RequestBody BrowseInfo browseInfo);

    /**
     * 添加关注信息
     * @param fanId
     * @param followedId
     * @return
     */
    @PostMapping("/balabala/follow/save")
    Resp addFollowInfo(@RequestParam Long fanId,@RequestParam Long followedId);


    /**
     * 删除关注信息
     * @param fanId
     * @param followedId
     * @return
     */
    @PostMapping("/balabala/follow/delete")
    Resp delFollowInfo(@RequestParam  Long fanId,@RequestParam  Long followedId);

    /**
     * 获取粉丝信息
     * @param followedId
     * @param page
     * @param limit
     * @return
     */
    @GetMapping("/balabala/follow/listByFollowedId")
    Resp getFans(@RequestParam Long followedId,@RequestParam Integer page,@RequestParam Integer limit);

    /**
     * 封禁用户
     * @param map
     * @return
     */
    @PostMapping("/balabala/user/batchdelete")
    Resp del_users(@RequestBody HashMap<String,Object> map);

    /**
     * 通过id查询被关注的人
     * @param fanId
     * @return
     */
    @RequestMapping("/balabala/follow/listByFanId")
    Resp getFollows(@RequestParam Long fanId,@RequestParam Integer page,@RequestParam Integer limit);


    /**
     * 查询评论
     * @param page
     * @param limit
     * @param key
     * @return
     */
    @RequestMapping("/balabala/comment/batchlist")
    Resp commentList(@RequestParam Integer page,@RequestParam Integer limit,@RequestParam String key);


    /**
     * 批量删除评论
     * @param commentIds
     * @return
     */
    @RequestMapping("/balabala/comment/batchdelete")
    Resp deleteComment(@RequestBody Long[] commentIds);


    /**
     * 获取视频列表
     * @param page
     * @param limit
     * @param key
     * @param state
     * @return
     */
    @GetMapping("/balabala/video/list")
    Resp getVideoList(@RequestParam Integer page, @RequestParam Integer limit,@RequestParam String key,@RequestParam Integer state);


    /**
     * 审核视频
     * @param hashMap
     * @return
     */
    @RequestMapping("/balabala/video/verify")
    Resp verifyVideo(@RequestBody Map<String,Object> hashMap);



}
